import request from "@/utils/request";
import type { GraphCode, LoginData, LoginParams, MobileCode } from "@/type/LoginType";
import type { ResponseType } from "@/type/ResponseType";

enum Enum {
   fetchGraphCodeAPI = "/captcha/image",
   fetchMobileCodeAPI = "/captcha/sendSmsCaptcha",
   loginAPI = "/passport/login"
}

/**
 * @description 获取图形验证码的接口
 * */
export const fetchGraphCodeAPI = () => request.get<GraphCode, ResponseType<GraphCode>>(Enum.fetchGraphCodeAPI);

/**
 * 获取手机验证码的接口
 * */
export const fetchMobileCodeAPI = (data: MobileCode) => request.post<[], ResponseType<[]>>(Enum.fetchMobileCodeAPI, data);

/**
 * @description 登录的接口
 * */
export const loginAPI = (data: LoginParams) => request.post<LoginData, ResponseType<LoginData>>(Enum.loginAPI, {form:data});
